home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
DELPHI32
/
GRAPHICS
/
IMGLIB95
/
UFGRAB.PA_
/
UFGRAB.PA
Wrap
Text File
|
1996-03-31
|
4KB
|
151 lines
{
Written by Jan Dekkers and Kevin Adams (c) 1995, 1996. If you are a non
registered client, you may use or alter this demo only for evaluation
purposes.
Copyright by SkyLine Tools. All rights reserved.
Part of Imagelib VCL/DLL Library.
}
unit Ufgrab;
{Includes settings to compile in either 16 or 32 bit}
{$I DEFILIB.INC}
interface
uses
{$IFDEF DEL32}
Windows,
{$ELSE}
WinTypes,
WinProcs,
{$ENDIF}
DLL95V1, {ImageLib Dll interface and misc. functions}
SysUtils,
Messages,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
MPlayer,
StdCtrls,
Buttons,
MMOpen, {Visual OpenDialog box}
TMultiMP, {PMultiMedia VCL component}
TMultiP; {PMultiImage VCL component}
type
TFrameGrab = class(TForm)
BitBtn1: TBitBtn;
PMultiMedia1: TPMultiMedia;
MMOpenDialog1: TMMOpenDialog;
Button1: TButton;
MIMediaPlayer1: TMIMediaPlayer;
Button2: TButton;
Memo1: TMemo;
GroupBox3: TGroupBox;
CTOJPEG: TRadioButton;
CTOBMP: TRadioButton;
CTOGIF: TRadioButton;
CTOPCX: TRadioButton;
CTOPNG: TRadioButton;
CTOTIF: TRadioButton;
Edit1: TEdit;
Label1: TLabel;
PMultiImage1: TPMultiImage;
Label2: TLabel;
procedure BitBtn1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure SaveAsChange(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FrameGrab: TFrameGrab;
implementation
{$R *.DFM}
{------------------------------------------------------------------------}
procedure TFrameGrab.BitBtn1Click(Sender: TObject);
begin
{Capture a video frame and display it}
PMultiImage1.VideoToPicture(PMultiMedia1.Handle);
end;
{------------------------------------------------------------------------}
procedure TFrameGrab.Button1Click(Sender: TObject);
begin
{Open a video file}
If MMOpenDialog1.Execute then
PMultiMedia1.MediaName:=MMOpenDialog1.Filename;
end;
{------------------------------------------------------------------------}
procedure TFrameGrab.Button2Click(Sender: TObject);
begin
Label2.Caption:='';
{Save the captured image to a file}
PMultiImage1.ImageWriteRes:=sColor256;
{Force extension}
SaveAsChange(Sender);
screen.cursor:=crHourGlass;
if CTOJPEG.Checked then
PMultiImage1.SaveAsJpg(Edit1.Text)
else
if CTOBMP.Checked then
PMultiImage1.SaveAsBMP(Edit1.Text)
else
if CTOTIF.Checked then
PMultiImage1.SaveAsTIF(Edit1.Text)
else
if CTOGIF.Checked then
PMultiImage1.SaveAsGIF(Edit1.Text)
else
if CTOPCX.Checked then
PMultiImage1.SaveAsPCX(Edit1.Text)
else
if CTOPNG.Checked then
PMultiImage1.SaveAsPNG(Edit1.Text);
screen.cursor:=crDefault;
Label2.Caption:='Saved';
end;
{------------------------------------------------------------------------}
procedure TFrameGrab.SaveAsChange(Sender: TObject);
begin
{Change extension}
if CTOJPEG.Checked then
Edit1.Text:=ChangeFileExt(Edit1.Text, '.JPG');
if CTOBMP.Checked then
Edit1.Text:=ChangeFileExt(Edit1.Text, '.BMP');
if CTOGIF.Checked then
Edit1.Text:=ChangeFileExt(Edit1.Text, '.GIF');
if CTOPCX.Checked then
Edit1.Text:=ChangeFileExt(Edit1.Text, '.PCX');
if CTOPNG.Checked then
Edit1.Text:=ChangeFileExt(Edit1.Text, '.PNG');
if CTOTIF.Checked then
Edit1.Text:=ChangeFileExt(Edit1.Text, '.TIF');
end;
{------------------------------------------------------------------------}
end.